package com.superjson.showpro.controller;

import com.beantools.annotation.handler.NotNullHandler;
import com.superjson.showpro.controller.core.BaseContoller;
import com.superjson.showpro.entity.Resume;
import com.superjson.showpro.shared.exception.GeneralBizException;
import com.superjson.showpro.shared.result.Result;
import com.superjson.showpro.service.ResumeService;
import com.superjson.showpro.shared.result.ResultUtil;
import org.codehaus.jackson.map.Serializers;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created By zby on 0:29 2019/5/29
 */
@RestController("resumeController")
@RequestMapping("/resume")
public class ResumeController extends BaseContoller{

    @Autowired
    private ResumeService resumeService;

    @RequestMapping(value = "/save", method = RequestMethod.POST)
    public Result saveResume(Resume resume) {
        try {
            NotNullHandler.getInstance().validate(resume);
            resumeService.saveResume(resume);
            return ResultUtil.buildSuccess();
        } catch (Exception e) {
            return ResultUtil.buildFailed(e.getMessage());
        }
    }
}
